//
//  XLVistorTableViewController.swift
//  WeiBo
//
//  Created by macbook on 16/10/17.
//  Copyright © 2016年 buWangChuXing. All rights reserved.
//

import UIKit

class XLVistorTableViewController: UITableViewController {

    //标识用户是否登陆
    let isLogin:Bool = XLUserAccountTools.shardTools.isLogin
    
    var vistorView = XLVistor?()
    
    
    override func loadView() {
        
        if isLogin {
            
            super.loadView()
        }else
        {
           setVistorView()
        }
    }
    
    
    private func setVistorView()
    {
        //添加两个item
        setVivstorLeftAndRightBarBtnItem()
        //创建
        vistorView = XLVistor()
        vistorView?.close = {[weak self] in
            self?.loninBtnItemClick()
        }
        
        view = vistorView
    }
    
    //设置访客视图的item
    private func setVivstorLeftAndRightBarBtnItem()
    {
        navigationItem.leftBarButtonItem = UIBarButtonItem(title: "登陆", style: .Plain, target: self, action: #selector(XLVistorTableViewController.loninBtnItemClick))
        
        navigationItem.rightBarButtonItem = UIBarButtonItem(title: "注册", style: .Plain, target: self, action:#selector(XLVistorTableViewController.loninBtnItemClick))
        
    }
    
  //按钮的实现
    @objc private func loninBtnItemClick()
    {
        let outhVc = XLOutchViewController()
        let navVc = UINavigationController(rootViewController: outhVc);
        presentViewController(navVc, animated: true, completion: nil)
        
    }
    
    
    
    
    
    override func viewDidLoad() {
        super.viewDidLoad()
        
        

    }
    
    
}
















